< previous page page_428 next page >

Page 428
Now add the code in Listing 11.10 to the mnuViewItem_Click event. This allows users to select the type of graph they view.
Type.gifListing 11.10. Coding the mnuViewItem_Click event.
Private Sub mnuViewItem_Click(Index As Integer)
    '
    ' handle view selections
    '
    Dim intGraphType As Integer
    '
    Select Case Index
        Case 0 ' pie chart
            intGraphType = gphPie3D
        Case 1 ' bar graph
            intGraphType = gphBar3D
        Case 2 ' line chart
            intGraphType = gphLine
        Case 3 ' area graph
            intGraphType = gphArea
    End Select
    '
    Graph1.GraphType = intGraphType
    Graph1.DrawMode = gphDraw
    '
End Sub
Now you're ready to code the GraphCopy method. The code in Listing 11.11 is all you need to copy the graph image to the Windows Clipboard. You can then paste this image of the graph from the Clipboard to any other Windows program that allows image cut and paste operations (Microsoft Write, for example).
Type.gifListing 11.11. This code copies the graph to the Windows Clipboard.
Public Sub GraphCopy()
    '
    ' copy graph to clipboard
    '
    Graph1.DrawMode = gphBlit
    Graph1.DrawMode = gphCopy
    Graph1.DrawMode = gphDraw
    '
    MsgBox "Graph has been copied to the clipboard", _
        vbInformation, _
        "Copy Graph"
    '
End Sub

 
< previous page page_428 next page >

If you like this book, buy it!